#ifndef CGAME_H
#define CGAME_H

#include "SGD Wrappers/CSGD_Direct3D.h"
#include "SGD Wrappers/CSGD_DirectInput.h"
#include "SGD Wrappers/CSGD_FModManager.h"
#include "SGD Wrappers/CSGD_TextureManager.h"
#include "GameState.h"

class CGame
{
private:
	//Other Singletons
	CSGD_Direct3D*			m_pD3D;
	CSGD_DirectInput*		m_pDI;
	CSGD_TextureManager*	m_pTM;
	CSGD_FModManager*		m_pFM;

	//Assets
	int m_nImageID;
	int m_nSoundID;

	//Window Size
	int m_nWindowWidth;
	int m_nWindowHeight;
	
	bool m_bIsWindowed;

	//for game timing
	DWORD m_dwFPSTimeStamp;
	float m_fElapsedTime; //dt in seconds
	float m_fGameTime; //how long the game has been running
	DWORD m_dwPreviousTimeStamp; //the time stamp from the previous frame
	float m_fTotalElapsedTime;
	

	//GameState
	IGameState*				m_pCurState;

	//Trilogy
	CGame();
	CGame(const CGame&);
	CGame& operator=(const CGame&);
	~CGame();

	//Utility
	bool Input();
	void Update();
	void Render();

public:
	float GetElapsedTime() {return m_fElapsedTime;}
	float GetTotalTime() {return m_fTotalElapsedTime;}
	static CGame* GetInstance();//gives us access to the singleton.

	void Initialize(HWND hwnd, HINSTANCE hInstance, int nWinWidth, int nWinHeight, bool isWindowed, bool isVSync);

	bool Execute(); //Returns false when it wants to quit.

	void Shutdown();

	void ChangeState(IGameState* pNewState);

	void SetWindowSize(int nWindowWidth, int nWindowHeight);
	int GetWindowWidth();
	int GetWindowHeight();
};

#endif